Cyclic data buffers are widely used. One function of cyclic buffers is to allow one entity (such as a hardware device) to pass data to another entity (such as software or firmware). The data passed via the cyclic buffer may, for example, be in the form of data packets.
One problem with conventional operation of cyclic buffers is that a block of data to be passed, such as a data packet, may “wrap around” from the end of the buffer to the beginning of the buffer. That is, a data packet may be stored so that it begins near the end of the buffer, and is continued at the beginning of the buffer. When wrap around occurs, data at a later part of the packet is stored at an offset from the beginning of the buffer that is less than an offset at which an earlier part of the packet is stored. This possibility and other complications involved in wrap around situations make it necessary for software or firmware that handles packets in the buffer to check to see whether the current packet wraps around and to take appropriate measures to handle wrap around when it occurs. As a result, the packet-handling software or firmware may be rather complicated.
The possibility of wraparound may also make it difficult or impossible to perform certain functions with respect to a packet stored in a cyclic buffer. Such functions may include parsing the packet, writing data into the packet, copying the packet, or jumping to a point within the packet based on an offset from the beginning of the packet.